package com.usian.feign;

import com.usian.pojo.TbContent;
import com.usian.pojo.TbContentCategory;
import com.usian.utils.AdNode;
import com.usian.utils.PageResult;
import com.usian.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "usian-content-service")
public interface ContentServiceFeign {
    /**
     * @param id
     * @return
     */
    @RequestMapping("/selectContentCategoryByParentId")
    public List<TbContentCategory>  selectContentCategoryByParentId(@RequestParam Long id);

    /**
     * @param parentId
     * @param name
     * @return
     */
    @RequestMapping("/insertContentCategory")
    public Integer insertContentCategory(@RequestParam Integer parentId,@RequestParam String name);


    /**
     * @param categoryId
     * @return
     */
    @RequestMapping("/deleteContentCategoryById")
    public Integer deleteContentCategoryById(@RequestParam("categoryId") Long categoryId);

    /**
     * 内容分类管理修改
     * @param id
     * @param name
     * @return
     */
    @RequestMapping("updateContentCategory")
    public Integer updateContentCategory(@RequestParam Long id,@RequestParam String name);

    /**
     * @param categoryId
     * @return
     */
    @PostMapping("/selectTbContentAllByCategoryId")
    public PageResult selectTbContentAllByCategoryId(@RequestParam(defaultValue = "1")Integer page, @RequestParam(defaultValue = "30")Integer rows,
                                                     @RequestParam  Long categoryId);

    /**
     * @param tbContent
     * @return
     */
    @RequestMapping("/insertTbContent")
    public Integer insertTbContent(@RequestBody TbContent tbContent);

    /**
     * @param id
     * @return
     */
    @RequestMapping("/deleteContentByIds")
    public Integer deleteContentByIds(@RequestParam("id") Long id);


    /**
     * 查询首页大广告位
     * @return
     */
    @RequestMapping("/selectFrontendContentByAD")
    public List<AdNode> selectFrontendContentByAD();
}
